1 00:00:00,230 --> 00:00:07,370 Now let's work on the condition where if you die in your battle royale, you get teleported back here. 2 00:00:07,580 --> 00:00:11,030 I'm going to go to my battle royale place. 3 00:00:11,060 --> 00:00:12,270 There we go. 4 00:00:12,290 --> 00:00:15,290 And let's go to our asset manager. 5 00:00:15,320 --> 00:00:24,140 If we go to view as the asset manager and open places, I need to get the original place ID so we're 6 00:00:24,140 --> 00:00:25,370 in the battle royale. 7 00:00:25,400 --> 00:00:33,800 Let's click on my zombie game, right click copy ID to clipboard, and then I'm going to go to my server 8 00:00:33,800 --> 00:00:35,300 script service. 9 00:00:35,420 --> 00:00:38,480 Hit the plus, add a script. 10 00:00:38,900 --> 00:00:39,440 There we go. 11 00:00:39,440 --> 00:00:46,220 And I'm going to call this battle Manager Battle MGR. 12 00:00:47,480 --> 00:00:49,160 I'll go ahead and close this. 13 00:00:49,670 --> 00:00:53,090 Hopefully I still have my ID in the buffer. 14 00:00:53,630 --> 00:00:56,100 I'll do a variable for the ID. 15 00:00:56,120 --> 00:00:58,020 I'm going to call it home ID. 16 00:00:58,040 --> 00:01:00,660 So when we go home, I'm going to make it a string. 17 00:01:00,680 --> 00:01:06,470 It should work as an integer or a string, but I always pass it as a string. 18 00:01:06,500 --> 00:01:08,210 That's why there's speech quotes, right? 19 00:01:08,240 --> 00:01:09,320 Because of the string. 20 00:01:09,710 --> 00:01:09,950 All right. 21 00:01:09,950 --> 00:01:11,090 What else do I need? 22 00:01:11,120 --> 00:01:14,630 I need my teleport service because we're going to go back. 23 00:01:14,630 --> 00:01:17,630 So I'll do ts equals game. 24 00:01:17,750 --> 00:01:19,520 Get service. 25 00:01:20,150 --> 00:01:22,130 Teleport service. 26 00:01:22,970 --> 00:01:24,530 And then I'm going to do a function. 27 00:01:24,530 --> 00:01:33,770 I'm going to say local function, add player to game and I'll pass the player in. 28 00:01:35,210 --> 00:01:41,300 Let me get the player and then I'm going to get the character added event. 29 00:01:42,950 --> 00:01:45,780 Connect that to an anonymous function. 30 00:01:45,800 --> 00:01:49,340 The character will get passed in as a parameter there. 31 00:01:49,350 --> 00:01:50,870 I'll just call it Char. 32 00:01:51,480 --> 00:01:56,100 Then I'm going to get the humanoid from the char the character. 33 00:01:56,100 --> 00:02:08,700 So char colon wait for child humanoid and on the humanoid I'm going to get the died event. 34 00:02:09,090 --> 00:02:10,200 So let's do that. 35 00:02:10,200 --> 00:02:14,060 Let's say Hume Dot died. 36 00:02:14,070 --> 00:02:18,150 COLON And then connect that to a function. 37 00:02:19,320 --> 00:02:21,720 New parameters will get passed in. 38 00:02:21,840 --> 00:02:26,970 I'll get the teleport service colon and then we'll teleport. 39 00:02:27,680 --> 00:02:34,880 Just go ahead and get the home ID, home ID, and we'll pass the player back. 40 00:02:37,920 --> 00:02:44,460 And we're going to call this when the player added event fires for the game. 41 00:02:44,460 --> 00:02:55,920 So I'm going to say game dot players, dot player added colon connect, add player to game and get rid 42 00:02:55,920 --> 00:02:59,290 of those two extra parentheses at Roblox likes to add. 43 00:02:59,310 --> 00:03:01,890 Now when we play our game, we die. 44 00:03:01,920 --> 00:03:07,380 We should get teleported back when we're in our battle royale back to our home land. 45 00:03:09,030 --> 00:03:11,940 Let's go ahead and save this off file. 46 00:03:12,180 --> 00:03:13,740 Publish to Roblox. 47 00:03:13,770 --> 00:03:16,650 Now, remember, we have to test it in the player. 48 00:03:16,650 --> 00:03:21,210 We can't use Roblox studio, so we'll go to create. 49 00:03:21,870 --> 00:03:23,550 There's my experience. 50 00:03:23,670 --> 00:03:28,800 Boom Zombie game view on Roblox and we'll hit play. 51 00:03:28,830 --> 00:03:30,960 Then I'll pause the video while it's loading up. 52 00:03:32,610 --> 00:03:33,810 All right, here we go. 53 00:03:41,480 --> 00:03:42,380 I'll accept. 54 00:03:42,380 --> 00:03:47,150 And then I'm going to pause the video until I show up in my battle royale world. 55 00:03:49,050 --> 00:03:50,160 Here we go. 56 00:03:50,880 --> 00:03:53,130 And we're in the battle royale world. 57 00:03:53,550 --> 00:03:56,450 Maybe I could bring up the console here. 58 00:03:56,460 --> 00:03:56,820 Let's see. 59 00:03:56,870 --> 00:03:59,640 Settings Developer console. 60 00:03:59,640 --> 00:04:01,740 Just in case anything weird happens. 61 00:04:01,830 --> 00:04:05,550 We don't have any messages being printed out. 62 00:04:06,870 --> 00:04:10,110 I'm going to kill myself by resetting the character. 63 00:04:10,290 --> 00:04:13,950 Hit that thing and we'll set reset character. 64 00:04:15,100 --> 00:04:16,780 Ah, Move this down. 65 00:04:17,170 --> 00:04:18,250 Reset. 66 00:04:19,560 --> 00:04:20,770 Oh, we died. 67 00:04:22,440 --> 00:04:22,770 Are. 68 00:04:24,910 --> 00:04:26,260 And we went back. 69 00:04:26,260 --> 00:04:28,270 So notice we died. 70 00:04:28,300 --> 00:04:32,200 We respond in the arena and then we came back. 71 00:04:32,200 --> 00:04:38,800 So what I think I'm going to do is increase the spawn time in the battle royale. 72 00:04:38,950 --> 00:04:41,260 Let's go to the other world. 73 00:04:41,260 --> 00:04:45,310 I'm going to turn this off first, so we'll just go ahead and leave. 74 00:04:48,690 --> 00:04:52,260 And we're in the battle royale place. 75 00:04:53,190 --> 00:04:57,090 So when I played the game, I timed the respawn time. 76 00:04:57,090 --> 00:04:59,810 I think I said spawn time, but it's the respawn time. 77 00:04:59,820 --> 00:05:03,390 It's almost eight seconds to do the teleporting. 78 00:05:03,390 --> 00:05:07,710 So let's go to our player service and change our respawn time. 79 00:05:08,340 --> 00:05:08,850 There we go. 80 00:05:08,850 --> 00:05:12,000 Respawn eight seconds. 81 00:05:12,000 --> 00:05:13,140 It's going to take you some time. 82 00:05:13,140 --> 00:05:15,180 If you die in the battle royale. 83 00:05:15,450 --> 00:05:18,420 Let's go ahead and hit publish to Roblox. 84 00:05:18,420 --> 00:05:24,690 I'm going to save the other one too, and we'll go publish to Roblox. 85 00:05:24,690 --> 00:05:26,340 Let's bring up our game. 86 00:05:27,050 --> 00:05:27,920 Play it. 87 00:05:30,730 --> 00:05:34,750 Go over here, initiate the battle, and then I'll pause it again so you don't have to wait. 88 00:05:35,410 --> 00:05:36,610 Except. 89 00:05:38,250 --> 00:05:38,610 All right. 90 00:05:38,610 --> 00:05:40,020 I am in my battle royale. 91 00:05:40,050 --> 00:05:41,940 Let's go ahead and kill ourselves off. 92 00:05:42,570 --> 00:05:44,310 Reset character. 93 00:05:44,910 --> 00:05:45,660 Boom. 94 00:05:46,450 --> 00:05:47,830 And let's see. 95 00:05:50,010 --> 00:05:51,630 And we are back. 96 00:05:51,750 --> 00:05:53,040 I think that'll work. 97 00:05:53,040 --> 00:05:58,650 And I kind of like the longer respawn time too, because then we can put like a little killed by guy 98 00:05:58,680 --> 00:05:59,160 up, right? 99 00:05:59,160 --> 00:06:03,810 While you're waiting for our teleport to go back to the home world. 100 00:06:03,900 --> 00:06:05,440 That's pretty cool. 101 00:06:05,460 --> 00:06:09,270 Let's go ahead and work on the winning of the game.